(function() {
    document.getElementById("loginButton").onclick = function() {
            login();
        }
        /**
         * 给enter键绑定监听事件
         */
    document.onkeydown = function(event) {
        e = event ? event : (window.event ? window.event : null);
        if (e.keyCode == 13) {
            //点击“enter”执行login方法 
            login();
        }
    }
})()
/**
 * 登陆函数
 */
var login = function() {
    var username = document.getElementById("username").value;
    var password = document.getElementById("password").value;
    if (!username || !password) {
        alert("用户名密码不能为空！");
    } else if (username === "admin" && password === "123456") {
        location.href = "./jump/main"
    } else if (username === "test" && password === "123456") {
        location.href = "./jump/main"
    } else {
        alert("用户名或密码输入有误！");
    }
}